package com.wh1200.mybatis.xmlless.model.base

import com.wh1200.mybatis.xmlless.AnnotatedElementDetailInfo
import com.wh1200.mybatis.xmlless.model.FieldMappingList
import com.wh1200.mybatis.xmlless.model.criteria.ParameterInfo

/**
 *
 * @author 吴昊
 * @date 2024/1/17 21:19
 * @since v0.0.0
 * @version 1.0
 */
interface BaseMethodWrapper {

  /**
   * @return
   */
  fun resolveReturnMappingList(): FieldMappingList?

  /**
   * @return
   */
  fun getReturnType(): Class<*>?

  /**
   * @return
   */
  fun getParameters(): List<ParameterInfo>

  /**
   * @return
   */
  fun getXmllessMethod(): BaseXmllessMethodWrapper

  /**
   * @return
   */
  fun getPropertiesMappingInner(): Map<String, String>

  fun getPropertiesMapping(): Map<String, String> {
    // 来自返回对象上的注解内容
    val originMap = this.getModelFields().filter {
      it.propertyMapTo.isNotBlank()
    }.associate {
      it.name to it.propertyMapTo
    }
    return originMap + getPropertiesMappingInner()
  }

  /**
   * @return
   */
  fun isJsonResult(): Boolean

  /**
   * @return
   */
  fun getResultMap(): List<String>

  /**
   * @return
   */
  fun getFullName(): String

  /**
   * @return
   */
  fun getExcludeProperties(): List<String>

  /**
   * @return
   */
  fun getSelectedProperties(): List<String>

  /**
   * @return
   */
  fun getName(): String

  /**
   * @return
   */
  fun isLogicDisabled(): Boolean

  /**
   * @return
   */
  fun getOptionalParameterNames(): Array<String>

  /**
   * @return
   */
  fun getModelFields(): List<AnnotatedElementDetailInfo>

  /**
   * @return
   */
  fun getModelName(): String

}
